package com.flying.oop.classmember.method;

/**
 * @ClassName: MethodDemo3
 * @createDate: 2023/6/21 7:35
 * @author: liu
 * @description:参数的使用
 */
public class MethodDemo3 {
    public static void main(String[] args) {

        //  方法调用时传入的参数，称为实参，实参的个数和类型要与方法声明的形参一致
        tellstory("庙","老和尚","小和尚");
        tellstory("道观","老道士","道童");
        tellstory("尼姑庵","师太","小尼姑");



    }


    /*
     方法声明时,()里的参数称为形式参数（形参）
     形参是用来站位的，保证业务逻辑的完整性
    */
    public static void tellstory(String place,String p1,String p2){
        System.out.println("从前有条河");
        System.out.println("河边有座"+place);
        System.out.println(place+"里有个"+p1);
        System.out.println("还有一个"+p2);
        System.out.println(p1+"在给"+p2+"讲故事");

    }
}
